package javazuoye.one;

import java.util.Stack;

/**
 * @author: 唐小尊
 * @email: 1171702529@qq.com
 * @cate: 2021/06/27 08:22
 */
public class _3_2_1 {
    public static void main(String[] args) {
        Stack<Integer> stack = new Stack<>();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.push(2);
        stack.push(3);
        stack.push(4);
        stack.push(5);
        stack.push(6);
        hahah(stack,2);
        System.out.println(stack);
    }
    public static void hahah(Stack<Integer> stack,int val){
        Stack<Integer> temp = new Stack<>();
        while (stack.size()>0){
            int now = stack.pop();
            if (now!=val){
                temp.push(now);
            }
        }
        while (temp.size()>0){
            stack.push(temp.pop());
        }
    }
}
